<#import '/ftlLibrary/properteisVariable.ftl' as pv/>
<style>
    input, select {
        height: 30px !important;
    }

    .control-label {
        margin-bottom: 0px !important;
        line-height: 30px !important;
    }

    .bootbox .modal-dialog {
        width: 55% !important;
    }

    .editForm > div {
        min-height: 30px;
    }

    .checkboxStyle label{
        margin:0px;
    }
    .bootbox-expand-button {
        width: 19px;
        height: 19px;
        border: none;
        cursor: pointer;
        -webkit-appearance: none;
        float: right;
        top: -18px;
        left: -30px;
        position: relative;
        background: #E9F5FF url("assets/img/nav-img/icon_window.png") no-repeat 0 0;
    }

    .bootbox-close-button {
        width: 19px;
        height: 19px;
        border: none;
        cursor: pointer;
        -webkit-appearance: none;
        float: right;
        top: 4px;
        left: -5px;
        position: relative;
        background: #E9F5FF url("assets/img/nav-img/icon_close.png") no-repeat 0 0;
    }

    .margin-bottom-15 {
        margin-bottom: 15px !important;
    }

    .expandView {
        width: 100%;
    }
</style>
<div class="row">
    <form class="editForm" style="margin-top: 15px" action="${saveUrl}" method="post" responseType="JSON" role="form"
          id="editForm_${serializeNum}"
          data-bv-submitButtons="#editFormSubmitBtn_${serializeNum}"
          data-bv-message="This value is not valid"
          data-bv-feedbackicons-valid="glyphicon glyphicon-ok"
          data-bv-feedbackicons-invalid="glyphicon glyphicon-remove"
          data-bv-feedbackicons-validating="glyphicon glyphicon-refresh">
        <input type="hidden" name="id" value="${editEntity.id}">
        <input type="hidden" name="memberId" value="${memberId}" class="memberId">
        <#if (true && editModel=='add')||(true && editModel=='edit')>
            <div class="col-xm-12 col-sm-12 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label class="col-sm-4 control-label no-padding-right" style="font-size: 13px!important;"><span class="red">*</span>客户状态：</label>
                    <div class="col-sm-7 checkboxStyle">
                        <@dictionary groupCode="stuStatus";dics>
                        <#list dics as dic>
                            <#if dic.code!=4&&dic.code!=5&&dic.code!=7>
                            <label style="font-size: 13px!important;">
                                <input required="required" data-bv-message="请选择客户状态" type="radio" class="stuStatusInput" name="status" value="${dic.code}" style="position: static;opacity: 1;margin: 0;width: 18px;height: 18px;">
                            </label>
                            <label style="font-size: 13px!important;">
                                ${dic.value}
                            </label>
                                </#if>
                        </#list>
                    </@dictionary>
                </div>
                </div>
            </div>
        </#if>

        <#if (true && editModel=='add')||(true && editModel=='edit')>
            <div class="col-xm-12 col-sm-12 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label for="nextFollowUpTime"
                           class="col-sm-4 control-label no-padding-right">下次跟进时间：</label>
                    <div class="col-sm-6">
										<span class="input-icon icon-left">
											<input data-bv-date-format="YYYY-MM-DD hh:mm:ss"
                                                   data-bv-message="The field is not valid"
                                                   data-bv-date-message="请正确输入一个时间" data-bv-date="false" size="10"
                                                   name="nextFollowUpTime" alt="下次跟进时间" id="nextFollowUpTime" placeholder="下次跟进时间"
                                                   type="text" title="下次跟进时间"
                                                   class="form-control form-control date-picker"
                                                   onfocus="WdatePicker({doubleCalendar:true,dateFmt:'yyyy-MM-dd HH:mm:ss'})"
                                                   value="${editEntity.nextFollowUpTime}"/>
											<i class="fa fa-calendar"></i>
										</span>
                    </div>
                </div>
            </div>
        </#if>
        <#if (true && editModel=='add')||(true && editModel=='edit')>
            <div class="col-xm-12 col-sm-12 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label for="subscribeAuditionTime"
                           class="col-sm-4 control-label no-padding-right">预约试听时间：</label>
                    <div class="col-sm-6">
										<span class="input-icon icon-left">
											<input data-bv-date-format="YYYY-MM-DD hh:mm:ss"
                                                   data-bv-message="The field is not valid"
                                                   data-bv-date-message="请正确输入一个时间" data-bv-date="false" size="10"
                                                   name="subscribeAuditionTime" alt="预约试听时间" id="subscribeAuditionTime" placeholder="预约试听时间"
                                                   type="text" title="预约试听时间"
                                                   class="form-control form-control date-picker"
                                                   onfocus="WdatePicker({doubleCalendar:true,dateFmt:'yyyy-MM-dd HH:mm:ss'})"
                                                   value="${editEntity.subscribeAuditionTime}"/>
											<i class="fa fa-calendar"></i>
										</span>
                    </div>
                </div>
            </div>
        </#if>
<#if (true && editModel=='add')||(true && editModel=='edit')>
    <div class="col-xm-12 col-sm-12 col-lg-12 margin-bottom-15">
        <div class="form-group">
            <label for="visitingTime"
                   class="col-sm-4 control-label no-padding-right">到访时间：</label>
            <div class="col-sm-6">
										<span class="input-icon icon-left">
											<input data-bv-date-format="YYYY-MM-DD hh:mm:ss"
                                                   data-bv-message="The field is not valid"
                                                   data-bv-date-message="请正确输入一个时间" data-bv-date="false" size="10"
                                                   name="visitingTime" alt="到访时间" id="visitingTime" placeholder="到访时间"
                                                   type="text" title="到访时间"
                                                   class="form-control form-control date-picker"
                                                   onfocus="WdatePicker({doubleCalendar:true,dateFmt:'yyyy-MM-dd HH:mm:ss'})"
                                                   value="${editEntity.visitingTime}"/>
											<i class="fa fa-calendar"></i>
										</span>
            </div>
        </div>
    </div>
</#if>
        <#if (true && editModel=='add')||(true && editModel=='edit')>
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group text-align-center">
                    <label class="col-sm-4 control-label no-padding-right">内容：</label>
                     <div class="col-sm-6">
                        <textarea class="form-control" name="content" rows="3"
                                  style="resize:none"  value="${data.content}"></textarea>
                        <span class="text"></span>
                    </div>
                </div>
            </div>
        </#if>
        <div class="col-sm-12 ">
            <div class="text-align-center">
                <button style="width: 80px;margin-right: 20px" type="submit" class="btn btn-blue"
                        id="editFormSubmitBtn_${serializeNum}">确定
                </button>
                <input style="width: 80px" type="button" class="btn btn-blue" data-dismiss="modal" value="取消"/>
            </div>
        </div>
    </form>

    <!-- 映射列表 -->
    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" id="leftTree">
        <div class="row" style="margin-bottom: 15px;margin-top:15px;font-size: 14px">
            <span style="padding-left: 16px">
                跟进信息
            </span>
        </div>
        <div class="widget flat radius-bordered" style="margin-top: 0;box-shadow:0px 0px 10px rgba(122,161,184,0.3);">
            <div class="widget-body no-padding">
                <div class="table-scrollable flowUpHistorys" style="border: none;">
                    <!-- 动态数据表列信息列表 -->
                </div>
            </div>
        </div>
    </div>
</div>
<script src="assets/js/validation/bootstrapValidator_init.js"></script>
<script>
    $(".selectpicker_${serializeNum}").select2();
    $("#editForm_${serializeNum}").bind("ajaxSubmitCallback", function (event, result) {
        if (result.resCode == 200) {
            loadFollowUpRecord();
            bootbox.hideAll();
            toView('tssStudentController/tssStudentList.do',true,'POST',{pageSize:10})
            logger.info("跟进成功", true);
        } else {
            logger.error("跟进失败");
        }
    });
    $(function(){
       loadFollowUpRecord();
    });

    var stustatus = "${stuStatus}";
    if(stustatus==4||stustatus==5||stustatus==7){
        $(".stuStatusInput").attr("disabled","disabled");
    }else {
        $(".stuStatusInput").each(function () {
            var valu = $(this).val();
            if(valu==stustatus){
                $(this).attr("checked","checked");
            }
        })
    }


    function loadFollowUpRecord(){
        var memberId=$(".memberId").val();
        ajaxRequest("tssMemberFollowUpRecordController/finfollowUpRecordByMemberId.do",{
            id:memberId
        }, function (html) {
            $(".flowUpHistorys").html(html);
            //var data=result.data;
//            var arr=['']; //<option value="0">请选择</option>
//            for (var i = 0; i< data.length; i++) {
//                arr.push('<tr>'+
//                    '<td>'+data[i].createTime+'</td>'+
//                    '<td>'+ data[i].status+'</td>'+
//                    '<td>'+ data[i].nextFollowUpTime+'</td>'+
//                    '<td>'+data[i].subscribeAuditionTime+'</td>'+
//                    '<td>'+ data[i].content+'</td>'+
//                    '</tr>');
//            }
//            $("#followUpRecord").html(arr.join(''))
        },function(){
            logger.error("加载员工信息失败");
        }, "post","html")

    }


    //    弹出层放大缩小
//    function expandView() {
//        $(".modal-dialog").toggleClass("expandView");
//        $(".modal-content").toggleClass("expandView");
//        $(".bootboxs").toggleClass("bootbox");
//    }
</script>